package com.sright.bcard.common.service.share.enums;

/**
 * 企业状态枚举类 0:正常 1:禁用 2:已过期
 */
public enum EnterpriseStatusEnum {
    NORMAL("正常" , 0),
    FORBIDDEN("禁用", 1),
    OFFTIME("已过期", 2),
    ;
    private String name;

    private Integer code;

    EnterpriseStatusEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static EnterpriseStatusEnum getEnum(String name) {
        try {
            return valueOf(name);
        } catch (Exception e) {
            return null;
        }
    }


    public static EnterpriseStatusEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }

        for (EnterpriseStatusEnum item : EnterpriseStatusEnum.values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    public Integer getValue() {
        return code;
    }

    public void setValue(Integer code) {
        this.code = code;
    }

    /**
     * 名片类型枚举 名片类型 0：通用 1：企业 2：个人
     */
    public enum CardTypeEnum {

        COMMON("通用" , 0),
        ENTERPRISE("企业", 1),
        PERSONAL("个人", 2),
        ;
        private String name;

        private Integer code;

        CardTypeEnum(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static CardTypeEnum getEnum(String name) {
            try {
                return CardTypeEnum.valueOf(name);
            } catch (Exception e) {
                return null;
            }
        }


        public static CardTypeEnum getEnumByValue(String value) {
            if (value == null) {
                return null;
            }

            for (CardTypeEnum item : CardTypeEnum.values()) {
                if (item.getValue().equals(value)) {
                    return item;
                }
            }
            return null;
        }

        public Integer getValue() {
            return code;
        }

        public void setValue(Integer code) {
            this.code = code;
        }

    }
}
